package server;

import lombok.Data;

import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * @Author: zhouzhijun
 * @Date: 2021/4/22 15:15
 */
@Data
public class Host {

    private String name;
    private String appBase;
    private List<Context> contexts = new ArrayList<>();

    public void init() {

        File pack = new File(appBase);
        File[] contextPackages = pack.listFiles();

        Arrays.stream(contextPackages).forEach(ctx -> {
            Context context = new Context();
            context.setContext(ctx.getName());
            context.setWorkDir(appBase);
            context.init();
            contexts.add(context);
        });

    }

}
